# Maintainer: Will Sinatra <wpsinatra@gmail.com>
# Contributor: Will Sinatra <wpsinatra@gmail.com>
pkgname=ruby-base64
_gemname=${pkgname#ruby-}
pkgver=0.2.0
pkgrel=0
pkgdesc="Ruby interface for encoding and decoding base64 data"
url="https://rubygems.org/gems/base64"
arch="noarch"
license="BSD-2-Clause"
makedepends="ruby ruby-dev ruby-rake-compiler"
checkdepends="ruby-rake ruby-bundler ruby-test-unit"
source="$pkgname-$pkgver.tar.gz::https://github.com/ruby/base64/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare

	sed -i '/spec.signing_key/d' $_gemname.gemspec
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc

	cd "$gemdir/gems/$_gemname-$pkgver"
	rm README.md LICENSE.txt
}

sha512sums="
e2b8f6b28de6eba1b6fdb6496ded0b37465f848d6b338715c715289a221ea9b2df3bef15f32d686cea53a76443f0ed0a183becdb666f842e54f827e08cf0f474  ruby-base64-0.2.0.tar.gz
"
